www.gusucode.com > VC++ 妙手连珠五子棋源码-源码程序 > VC++ 妙手连珠五子棋源码-源码程序\code\Dlgoption.cpp

    // Dlgoption.cpp : implementation file
// Download by http://www.NewXing.com

#include "stdafx.h"
#include "7.h"
#include "Dlgoption.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDlgoption dialog


CDlgoption::CDlgoption(CWnd* pParent):CDialog(CDlgoption::IDD, pParent)
{

	//{{AFX_DATA_INIT(CDlgoption)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT

}


void CDlgoption::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgoption)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgoption, CDialog)
	//{{AFX_MSG_MAP(CDlgoption)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgoption message handlers


void CDlgoption::setoption(int model,int aitype)
{
	CDlgoption::aitype=aitype;
	CDlgoption::model=model;
}
	


BOOL CDlgoption::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	if (CDlgoption::model==0) 
	CDlgoption::CheckRadioButton(IDC_RADIO1, IDC_RADIO3,IDC_RADIO1);
	else
		if (CDlgoption::model==1)
			CDlgoption::CheckRadioButton(IDC_RADIO1, IDC_RADIO3,IDC_RADIO2);
		else
			if (CDlgoption::model==2)
				CDlgoption::CheckRadioButton(IDC_RADIO1, IDC_RADIO3,IDC_RADIO3);

	if (CDlgoption::aitype==0) 
	CDlgoption::CheckRadioButton(IDC_RADIO4, IDC_RADIO6,IDC_RADIO4);
	else
		if (CDlgoption::aitype==1)
			CDlgoption::CheckRadioButton(IDC_RADIO4, IDC_RADIO6,IDC_RADIO5);
		else
			if (CDlgoption::aitype==2)
				CDlgoption::CheckRadioButton(IDC_RADIO4, IDC_RADIO6,IDC_RADIO6);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

int CDlgoption::getmodel()
{
	return CDlgoption::model; 
}
int CDlgoption::getai()
{
	return CDlgoption::aitype; 
}


void CDlgoption::OnOK() 
{
	int tem=CDlgoption::GetCheckedRadioButton (IDC_RADIO4,IDC_RADIO6);
	if (tem==IDC_RADIO4)
		CDlgoption::aitype=0; 
		else
		if(tem==IDC_RADIO5)
		CDlgoption::aitype=1;
		else
			if(tem=IDC_RADIO6)
				CDlgoption::aitype=2;
			else
				CDlgoption::aitype=1;
	tem=CDlgoption::GetCheckedRadioButton (IDC_RADIO1,IDC_RADIO3);
	if (tem==IDC_RADIO1)
		CDlgoption::model=0;
	else
		if(tem==IDC_RADIO2)
			CDlgoption::model=1;
		else
			if(tem=IDC_RADIO3)
				CDlgoption::model=2;
			else
				CDlgoption::model=0;

	CDialog::OnOK();
}